Eecient and Precise Sharing Domains for Logic Programs

نویسنده

  • Christian Fecht
چکیده

interpretation [8, 9] formalizes program analysis as approximate computation. Instead of executing a program with data, it is executed with descriptions of the data. In our case, this means that logic programs are executed with abstract substitutions instead of concrete substitutions. Concrete and abstract substitutions are related by a description relation. To every operation on the concrete substitutions, there must exist a corresponding abstract operation mimicking the concrete operation on the abstract substitutions. A generic abstract interpreter [4] is an abstract interpreter which is parametrized over an abstract domain. An abstract domain consists of a complete lattice (Asub; ; ?; >; t) of abstract substitutions and the abstract versions of the concrete operations. The description relation between concrete and abstract substitutions is often given by an abstraction function : P(Subst) ! Asub or by a concretization function : Asub! P(Subst). In the case of logic programs, the abstract domainmust further provide an abstract uni cation procedure aunify : Asub V Term! Asub, and functions for abstract procedure entry and exit. An assignment is a mapping : V ! f0; 1g from variables to truth values. A Boolean function f : (V! f0; 1g)! f0; 1g maps assignments to truth values. An assignment is a model of the Boolean function f if f( ) = 1 holds. A Boolean function f is positive if f(1) = 1 where 1 is the assignment that maps each variable to truth value 1. A Boolean function is de nite if the set of all its models is closed under intersection. Boolean functions can be ordered by the implication order. The resulting poset is a complete lattice. The ground variables of substitution # can be represented by an assignment [#]. [#](X) = 1 ; X is ground with respect to # 0 ; otherwise De nition 3 A Boolean function f describes a substitution # 2 Subst if f([ ]) = 1 for all #. The groundness domains POS and DEF [1] consist of the complete lattice of positive Boolean functions and de nite Boolean functions, respectively, with the above description relation. 3 The Sharing Domain of Jacobs/Langen The sharing domain JL of Jacobs and Langen [16] represents substitutions by sets of sets of variables, such as f;; fXg; fX;Y g; fU; Y; Zgg. The key notion in the de nition of JL is that of occurrence. De nition 4 occ : Subst V! P(V) occ(#;X) = fY 2 V j X 2 vars(Y #)g De nition 5 The abstract domain JL: lattice : AsubJL = fS 2 P(P(V)) j S 6= ; ) ; 2 Sg order : vJL = lub : tJL = [ abs : JL( ) = S#2 focc(#; X) j X 2 Vg Example 1 Let V = fU; V;W;X; Y; Zg be the variables of interest and # = fU=a;X=g(Y; V ); Z=f(W;Y )g. occ(#; U ) = ; occ(#; V ) = fV;Xg occ(#;W ) = fW;Zg occ(#;X) = ; occ(#; Y ) = fX;Y; Zg occ(#; Z) = ; Thus, JL(#) = f;; fV;Xg; fW;Zg; fX;Y; Zgg. 2 The elements of an abstract substitution S 2 AsubJL are called sharing groups and are themselves sets of variables. It is well known that an abstract substitution S 2 AsubJL expresses the following information. Sharing Variables X and Y share in any substitution # described by S if there exists a sharing group A 2 S with X;Y 2 A. More formally, share( JL(S)) = f(X;Y ) j X 6= Y; 9A 2 S : X;Y 2 Ag Groundness VariableX is de nitively ground in any substitution described by S if X does not occur in any sharing group of S, i.e., X 62 vars(S). More formally, ground ( JL(S)) = V vars(S) Ground Dependencies In [7] it is shown that S expresses ground dependencies which coincide with the de nite Boolean function def JL(S) de ned as def JL(S) = ^f^W1 ! ^W2 j 8M 2 S: (W2 \M 6= ;)) (W1 \M 6= ;)g Example 2 Let V = fU;W;X; Y; Zg be the variables of interest. Consider the abstract substitution S = f;; fXg; fX;Y g; fY; Zg; fU;X;Zgg. The following information is expressed by S: sharing pairs f(X;Y ); (Y; Z); (U;X); (X;Z)g ground variables fWg dependencies W ^ (X ! U ) ^ (Z ! U ) ^ (U ^ Y ! Z) ^ (X ^ Y ! Z) ^ (X ^ Z ! Y ) 2 Abstract Uni cation We need some additional de nitions in order to de ne the abstract uni cation function aunifyJL : Asub V Term! Asub. S1 1 S2 = fA [B j A 2 S1; B 2 S2g SjM = fA 2 S j A \M 6= ;g 3 De nition 6 A set S 2 P(P(V)) is closed under union if A 2 S and B 2 S implies A [ B 2 S. The least superset of S that is closed under union is denoted by S . Abstract uni cation aunifyJL(S; X; t) is de ned by following three cases. Case 1: X 62 vars(S) X is ground. After the successful uni cation all variables occurring in t must be ground, too. Therefore, we remove all sharing groups from S that contain at least one variable from t. ) aunifyJL(S; X; t) = S fA 2 S j A \ vars(t) 6= ;g. Case 2: vars(t) \ vars(S) = ; All variables in t are ground. After the successful unication X must be ground, too. Therefore, we remove from S all sharing groups that contain X. ) aunifyJL(S; X; t) = S fA 2 S j X 2 Ag Case 3: Neither X 62 vars(S), nor vars(t)\vars(S) = ; ) aunifyJL(S; X; t) = (S SjfXg[vars (t)) [ (SjfXg) 1 (Sjvars(t)) . The rst two cases deal with the propagation of groundness. Note that a ground variable cannot share with any other variable. If variable X becomes ground through uni cation, all sharing groups containingX can be safely removed from S. Case 3 is the most complicated one. The sharing groups which contain a variable occurring in the uni cation equation X = t are replaced by the pairwise union of the closure of all groups sharing with the left-hand side and the closure of all groups sharing with right-hand side of the equation. Example 3 Consider S = f;; fUg; fXg; fYg; fX;Y g; fY; Zg; fU;Zgg and the uni cation equation X = f(Y; Z). Let us compute aunifyJL(S; X; f(Y; Z)). SjfXg = ffXg; fX;Y gg (SjfXg) = ffXg; fX;Y gg SjfY;Zg = ffY g; fX;Y g; fY; Zg; fU;Zgg (SjfY;Zg) = ffY g; fX;Y g; fY; ZgfU;Zg; fX;Y; Zg; fU; Y; Zg; fU;X; Y; Zgg Thus, (SjfXg) 1 (Sjvars(t)) = ffX;Y g; fX;Y; Zg; fU;X;Zg; fU;X; Y; Zgg and the result of the uni cation is aunifyJL(S; X; f(Y; Z)) = f;; fUg; fX;Y g; fX;Y; Zg; fU;X;Zg; fU;X; Y; Zgg. 2 To summarize,JL accurately models sharing and ground dependencies. However, it is too ine cient in practice (see section 6). The abstract uni cation procedure is very ine cient. The computation of the closure S has exponential worst-case complexity. Application of the closure operator and the subsequent pairwise union rapidly lead to combinatorial explosion. 4 The Abstract Domains #JL and #JL+POS One of the nice features of abstract interpretation is that one can always replace a description d by a greater description d0, e.g., d v d0. By doing so, the overall result of the abstract operations may be less precise, but it will always be correct. The correctness of the nal result follows from the monotonicity of the description relation and the monotonicity of the abstract operations. This idea is utilized, for instance, in the technique of widening [8, 10] which speeds up xpoint iterations or even forces possibly in nite iterations to terminate. Another application of the replacement idea would be to replace a description d whose computer representation is to big by a greater description with a more e cient representation. Let us apply this idea in order to cope with the inherent ine ciency of abstract domain JL. Thus, we replace an S 2 AsubJL by an S0 with S S0. Unfortunately, S0 contains more sharing groups than S. If we represent power sets of variables explicitly by listing their elements, then the representation of S0 is larger than the representation of S. Thus, replacing S by S0 does not only result in a loss of precision, but also makes the abstract interpretation even more ine cient. Nevertheless, we can apply our idea if we ensure that S0 is always chosen in such a way that it allows for a compact representation. Good candidates are those sets which are downward closed. De nition 7 A set S 2 P(P(V)) is downward closed i the following holds: M 2 S implies N 2 S for each N M . De nition 8 The downward closure #S of a powerset S 2 P (P(V)) is de ned by #S = fN V j 9M 2 S with N Mg. A set S 2 P(P(V)) is represented by a set E 2 P(P(V)) i S = #E. It is well-known that downward closed sets are represented by its maximal elements as the following lemma states. Lemma 1 If S 2 P(P(V)) is downward closed, then S can be represented by its maximal elements: S = #fM 2 S jM is maximal in Sg. Example 4 Consider the downward closed set S = f;; fXg; fY g; fZg; fWg; fX;Yg; fX;Zg; fY; Zg; fX;Wg; fX;Y; Zgg. Set S is represented by its maximal elements ffX;Y; Zg; fX;Wgg. Note that S = #ffX;Y; Zg; fX;Wgg. 2 As explained above, an abstract substitution S 2 AsubJL expresses sharing information, de nite groundness, and ground dependencies. What is lost when S is replaced by its downward closure #S? 4 Lemma 2 1. shareJL(#S) = shareJL(S) 2. groundJL(#S) = groundJL(S) 3. def JL(#S) = V groundJL(S) By taking the downward closure, only the ground dependencies are lost. The sharing and de nite groundness information are not changed. Note, that the union of downward closed sets is downward closed, too. A new sharing domain #JL can thus be obtained from JL by restricting the set of abstract substitutions to downward closed powersets of variables. The abstract uni cation in #JL is the downward closure #aunifyJL(S; X; t)) of the result of the abstract uni cation in JL. De nition 9 The abstract domain #JL: Asub#JL = fX 2 P(P(V)) j S is downward closedg v#JL = t#JL = [ #JL( ) = #S#2 focc(#; X) j X 2 Vg aunify#JL(S; X; t) = #aunifyJL(S; X; t) The soundness of the abstract uni cation in #JL follows from the soundness of the abstract uni cation in JL and from aunifyJL(S; X; t) aunify#JL(S; X; t) for all downward closed S 2 P(P(V)), X 2 V, and terms t. So far, nothing has been gained since abstract unication in #JL is de ned in terms of abstract interpretation in JL. Since a downward closed powerset S is represented by a powerset E with S = #E, we will next de ne abstract uni cation directly on the representation E instead of #E. To this end, we make the following simple observations: 1. The powerset #E contains the same variables as its representation E, i.e., vars(E) = vars(#E). 2. Removing all sets from #E which have a common element with set G is done on the representation by removingG from each set in E, i.e., #fA 2 #E j A \G = ;g = #fA G j A 2 Eg. 3. The representation of a powerset (#E) which is closed under union is simply the union of all sets in E, i.e., #(#E) = #(S E). Note that the representation of (#E) is a singleton. 4. #((#E1) 1 (#E2)) = #(E1 [E2). It should now be relatively easy to de ne the abstract uni cation aunify#JL(#E; X; t) on the representation E directly. We consider the following three cases. Case 1: X 62 vars(E) Since vars(#E ) = vars(E), variable X is ground and, therefore all variables in t have to be ground, too. We remove all sharing groups from #E which contain a variable from vars(t). On the representation, this is achieved by deleting all variables in vars(t) from E. ) aunify#JL(#E; X; t) = #fA vars(t) j A 2 Eg Case 2: vars(t) \ vars(E) = ; By the same argument as above, we conclude that X has to be ground. Therefore X is removed from the representation E. ) aunify#JL(#E; X; t) = #fA fXg j A 2 Eg Case 3: Neither X 62 vars(E) nor vars(t)\vars(E) = ; ) aunify#JL(#E; X; t) = #((E EjfXg[vars(t)) [ SEjfXg[vars(t)) The third case which actually deals with sharing has been greatly simpli ed. Instead of computing closures under union and pairwise unions of powersets, all sharing groups of the representation which contain a variable in vars(X = t) are replaced by their union. Theorem 1 aunify#JL(#E;X; t) = #aunifyJL(#E;X; t). In contrast to JL abstract domain #JL does not model ground dependencies between variables. Hence, #JL may detect less ground variables than JL. Since no ground variable can share with any other variable, #JL may detect much more sharing pairs than JL. In order to compensate this loss of precision, we add the groundness domain POS [20, 1, 27] to #JL. Although groundness analysis with POS has to solve a theoretically intractable problem, implementations of POS are amazingly fast in practice. The reduced product [9] of #JL and POS is denoted #JL+POS. Abstract domain POS will never infer less ground variables than DEF. As a consequence, #JL+POS is more precise with respect to groundness than JL. Abstract uni cation in #JL+POS is similar to abstract uni cation in #JL. The main di erence is that ground variables are not inferred from the sharing component, but from the POS-component. Principally, abstract uni cation is independently done both in the sharingand POS-component of the abstract substitution, and then the resulting pair is reduced. Reduction amounts to assuring that variables that are ground according to the POS-component do not occur in any sharing group in the sharing component of the abstract substitution. 5 Comparison of JL and #JL+POS As shown above, #JL does not express ground dependencies between variables. To remedy this, we have added the groundness domainPOS to #JL yielding the abstract domain #JL+POS. Since there are programs for which POS computes strictly better groundness information than DEF, which is a part of JL, there are 5 also programs where #JL+POS computes strictly better sharing information than JL. Example 5 Consider the following logic program: main :p(X, Y), X = Y. p(a, ). p( , b). POS infers that both X and Y are ground after the uni cation X = Y . Thus, #JL+POS infers that X and Y are independent at the exit point of main/0. To the contrast, DEF is not able to infer the groundness of X and Y . Hence, an analysis with JL yields that X and Y possibly share at the exit point of main/0. 2 Besides de nite groundness and ground dependencies, JL does express a further property which is useful for computing better sharing information. This property (strong coupling between sharing pairs) is illustrated by the following example. Example 6 Let V = fX;Y; Zg be the variables of interest. Consider the following abstract substitutions in JL. S1 = f;; fXg; fY g; fZg; fX;Y; Zgg S2 = f;; fXg; fY g; fZg; fX;Y g; fY; Zg Both S1 and S2 express the same sharing information (f(X;Y ); (X;Z); (Y; Z)g) and the same ground dependencies (1 2 DEF). Note that S2 is downward closed and thus S2 2 #JL. Now consider the uni cation X = a. Grounding X in S1 yields f;; fY g; fZgg. Thus, there is no sharing between Y and Z. Although variable X does not occur in the sharing pair (Y; Z), the grounding of X has removed the sharing pair (Y; Z). The sharing pairs (X;Y ), (X;Z), and (Y; Z) are strongly coupled in S1. Grounding one of fX;Y; Zg will remove all sharing between these variables. However, grounding X in S2 yields f;; fY g; fZg; fY; Zgg. Thus, there is still a possible sharing between Y and Z. 2 This example shows that there are programs where JL computes strictly better sharing information than #JL+POS. Summarizing, JL and #JL+POS are uncomparable. In practice, however, JL is at least as accurate as #JL. 6 Implementation and Experimental Evaluation In order to practically compare e ciency and precision of JL and #JL+POS we implemented analyzers based on these domains and run them on a large set of Prolog programs. The implementation work has been greatly simpli ed by the use of the Prolog analyzer generator GENA [14] which is implemented itself in SML. The xpoint algorithm we used for the benchmarks is the generic and general algorithm WRT from [13]. This algorithm computes a part of the precise abstract inputoutput semantics [[P ]] : Pred Asub! Asub. Sets of variables are implemented by lists of integers where each integer is used as a bit vector. Since most clauses have less than 31 variables, this representation is very compact and e cient. Powersets of variables are implemented as balanced binary trees over sets of variables. Downward closed powersets are canonically represented as the list of their maximal elements. At last, Boolean functions are implemented by binary decision diagrams [3, 2, 27], the state-of-the-art technique for representing and manipulating Boolean functions in computers. Figure 1 shows the results of our experiments. The measurements were done on a Sun 20 with 64MB main memory. We used SML of New Jersey version 109. The analysis times include system and garbage collection time and are the average of ve runs. Our analyzer computes call modes for the predicates in the program. A call mode for a predicate is a statement about its arguments. The precision of a call mode measured as the number of sharing pairs between arguments. The precision in gure 1 is the sum of the precisions of the call modes for all predicates in the program. Recall that the less the number of sharing pairs, the higher is the precision. Some of the programs in our benchmark suite are large real-word applications: aqua-c is the complete source code of Peter Van Roy's Aquarius Prolog compiler (about 16000 lines of code), b2 is a large mathematical application (about 2000 lines of code), chat is D.H.D. Warrens chat-80 system (about 5000 lines of code), and read and readq are Prolog readers. The other programs were either taken from the benchmark suite of Aquarius Prolog or from the benchmark suites of the GAIA [4] and PLAIA [23] systems. The following observations can be made from the numbers of gure 1: 1. Programs action, aqua-c, chat , chat-parser , reducer and sdda could not be analyzed by JLwithin one hour. Even worse, none of them could be ever analyzed completely. For instance, the analysis of chat-parser had to been interrupted after seven (!) days. The inability of JL to analyze these programs is not due to the actual size of the programs (reducer and sdda are smal programs each having about 300 lines of code), but to the large number of variables in some of their clauses. 2. All programs can be analyzed with #JL+POS. 6 Programme ciencyprecision#JL+POS JLratio #JL+POS JLaction.pl11.761141?ann.pl0.51 14.32 28.34242aqua-c.pl212.07113879?b2.pl1.61 48.83 30.34848boyer.pl0.211.336.52020browse.pl0.105.35 51.566chat.pl21.95111152?chat-parser.pl7.8511439?chess.pl0.35 33.83 95.61918circuit.pl0.050.050.900cs.pl0.221.928.922atten.pl0.31 15.56 49.63232gabriel.pl0.140.261.81111life.pl0.080.111.411nand.pl0.802.993.700peep.pl0.190.140.700press.pl0.85 13.65 16.05050read.pl0.654.627.23030readq.pl2.28 103.89 45.6100100reducer.pl0.5111104?scc.pl0.350.310.900sdda.pl0.421153?sendmore.pl0.210.291.411serialise.pl0.112.72 25.21010triangle.pl0.160.100.600wgc.pl0.040.030.711Table 1: Experimental Evaluation of #JL+POS andJL Most analysis times are very small or at least mod-erate. Even the huge aqua-c could be analyzedwithin reasonable time. Programs reducer andsdda which JL was unable to analyze are analyzedby #JL+POS within half a second. On most pro-grams, #JL+POS is dramatically faster than JL.3. For most programs, #JL+POS infers the samenumber of sharing pairs than JL. Indeed, there isonly one program (chess) where #JL+POS is lessprecise and infers one additional sharing pair. Thisloss of precision is due to inability of #JL+POSto express strong coupling between sharing pairs.Thus, #JL+POS seems to have almost the sameprecision than JL in practice.7 The Impact of LinearityA variable X is linear in a substitution # if no variableoccurs more than once in X#. De nite linearity infor-mation is useful for computing accurate sharing infor-mation [25, 19, 5].Example 7 Consider the uni cation X = f(Y; Z) andassume that X, Y , and Z are all nonground and inde-pendent before the uni cation. If X is bound to a linearterm, then Y and Z are still independent after the uni-cation. However, if X is bound to a nonlinear term,variables Y and Z may possibly share after the uni -cation, e.g., consider the case where X is bound to thenonlinear term f(A;A).2Linearity does not only help to compute better sharinginformation. It heavily a ects the e ciency of the shar-ing analysis. In JL, linearity information helps to avoidthe expensive closure under union operation [25]. Notcomputing the closure under union keeps the sets of setsof variables small which additionally speeds up subse-quent computations. We also implemented the abstractdomains JL+LIN and #JL+POS+LINbased on thedescription in [25]. The results of our experiments areshown in gure 7.1. The abstract domains with linearity JL+LIN and#JL+POS+LIN often compute substantially bet-ter sharing information than JL and #JL+POS,respectively.2. For some programs, JL+LIN is dramatically fasterthan JL. However, there are some programs (ac-tion, aqua-c, chat , chat-parser, reducer , sdda)which could not be analyzed with JL+LIN. Wehad to interrupt the analyzer after one hour.3. #JL+POS+LIN can analyze all program in rea-sonable time. Most programs are analyzed veryfast. For all our programs, #JL+POS+LIN hasthe same precision as JL+LIN.8 Related Work and ConclusionWe have presented two new domains for sharing anal-ysis of logic programs. The new domains #JL+POSand #JL+POS+LIN have been derived systematicallyfrom the sharing domains JL and JL+LIN. As a con-sequence, the soundness of the abstract uni cation pro-cedure was easily established. The new domains wereexperimentally evaluated on a large set of Prolog pro-grams. In practice, they seem to have almost the sameprecision than the domains JL and JL+LIN, respec-tively. More important, the new domains are substan-tially more e cient.In contrast to previous work on sharing analysis [23,23, 19, 25, 5, 21], we evaluated our analyzers on a largeset of Prolog programs, including large real-word pro-grams which are hard to analyze. Our sharing analyzers7 Programme ciencyprecision#JL+POS+LIN JL+LIN ratio #JL+POS+LIN JL+LINaction.pl32.121137?ann.pl0.764.726.22424aqua-c.pl690.51113327?b2.pl2.493.541.42323boyer.pl0.431.764.12020browse.pl0.142.04 15.022chat.pl36.7711887?chat-parser.pl12.8811267?chess.pl0.7119.74 27.977circuit.pl0.060.050.900cs.pl0.240.160.600atten.pl0.6314.62 23.42222gabriel.pl0.220.231.111life.pl0.090.060.700nand.pl1.050.620.600peep.pl0.240.160.700press.pl1.264.023.24242read.pl0.691.081.655readq.pl2.8152.82 18.84444reducer.pl0.8711100?scc.pl0.440.270.600sdda.pl0.911153?sendmore.pl0.210.160.800serialise.pl0.264.40 16.999triangle.pl0.180.100.600wgc.pl0.040.030.700Table 2: Experimental Evaluation of #JL+POS+LINand JL+LINare substantially faster than the analyzers described in[5, 21]. This may partly be due to the fact that we usea highly optimized SML implementation with e cientdata structures, whereas the analyzers from [5, 21] arebased on the PLAIA system [23] which is implementedin Prolog.Our experiments con rm that linearity can signi -cantly improve the quality of the sharing analysis. Thiswas already pointed out in [5, 21]. Thus, future sharinganalyzers should include a linearity component.Our new abstract domains have been carefully de-signed in order to remedy the e ciency problems of JLand JL+LIN. To our knowledge, #JL+POS+LIN isthe fastest sharing analyzer reported so far. It is pre-cise and fast enough to be integrated into a productionquality Prolog compiler.Acknowledgement We would like to thank HelmutSeidl for many fruitful discussions on the expressivenessof the sharing domains JL.References[1] T. Armstrong, K. Marriott, P. Schachte, andH. S ndergaard. Boolean Functions for Depen-dency Analysis: Algebraic Properties and E -cient Representation. In International Static Anal-ysis Symposium SAS'94, pages 266{280. Springer-Verlag LNCS 864, 1994.[2] K.S. Brace, R.L. Rudell, and R.E. Bryant. E -cient Implementation of a BDD Package. In 27thACM/IEEE Design Automation Conference, pages40{45, 1990.[3] R.E. Bryant. Graph-Based Algorithms for BooleanFunction Manipulations. IEEE Transactions onComputers, C-35(8), August 1986.[4] B. Le Charlier and P. Van Hentenryck. Experi-mental evaluation of a generic abstract interpreta-tion algorithm for Prolog. TOPLAS, 16(1):35{101,1994.[5] M. Codish, A. Mulkers, M. Bruynooghe, M. Garc ade la Banda, and M. Hermenegildo. Improv-ing Abstract Interpretations by Combining Do-mains. ACM Transactions on Programming Lan-guages and Systems (TOPLAS), 17(1):28{44, Jan-uary 1995.[6] J.S. Conery. Parallel Execution of Logic Programs.Kluwer Academic Publishers, 1987.[7] A. Cortesi, G. Fil e, and W. Winsborough. Com-parison of Abstract Interpretations. In ICALP'92,pages 521{532. Springer Verlag, LNCS 623, 1992.[8] P. Cousot and R. Cousot. Abstract Interpretation:A Uni ed Lattice Model for Static Analysis of Pro-grams by Construction or Approximation of Fix-points. In POPL'77, pages 238{252, 1977.[9] P. Cousot and R. Cousot. Abstract Interpretationand Application to Logic Programs. Journal ofLogic Programming, 13(2):103{179, 1992.[10] P. Cousot and R. Cousot. Comparing the GaloisConnection and Widening/Narrowing Approachesto Abstract interpretation. In M. Bruynooghe andM. Wirsing, editors, Programming Language Im-plementation and Logic Programming, PLILP'92,pages 269{295, Leuven, Belgium, 1992. SpringerVerlag, LNCS 631.[11] L. Crnogorac, A.D. Kelly, and H. S ndergaard.A Comparison of Three Occur-Check Analysers.In Third International Static Analysis Symposium(SAS'96), Aachen, Germany, 1996. Springer Ver-lag, LNCS.8 [12] Saumya K. Debray. Automatic Mode Inference forProlog Programs. Journal of Logic Programming,5:207{230, 1988.[13] C. Fecht and H. Seidl. An Even Faster Solver forGeneral Systems of Equations. In Static AnalysisSymposium (SAS'96), Aachen, 1996. Springer Ver-lag, LNCS.[14] Christian Fecht. GENA { a Tool for GeneratingProlog Analyzers from Speci cations. In Alan My-croft, editor, Second International Symposium onStatic Analysis (SAS'95), pages 418{419. SpringerVerlag, LNCS 983, 1995.[15] M. Hermenegildo. An Abstract Machine Based Ex-ecution Model for Computer Architecture Designand E cient Implementation of Logic Programs inParallel. PhD thesis, University of Texas at Austin,1986.[16] D. Jacobs and A. Langen. Static analysis of logicprograms for independent and-parallelism. Journalof Logic Programming, 13:291{314, 1992.[17] G. Janssens and W. Simoens. On the Implementa-tion of Abstract Interpretation Systems for (Con-straint) Logic Programs. In Peter Fritzson, editor,Compiler Construction, 5th International Confer-ence, CC'94, pages 172{187, Edinburgh, U.K.,1994. Springer Verlag, LNCS 786.[18] N.D. Jones and H. S ndergaard. A semantics-basedframework for the abstract interpretation of PRO-LOG. In S. Abramsky and C. Hankin, editors,Abstract Interpretation of Declarative Languages,pages 123{142. Ellis Horwood, 1987.[19] A. King. A Synergistic Analysis for Sharing andGroundness which Traces Linearity. In DonaldSannella, editor, ESOP'94, 5th European Sympo-sium on Programming, pages 363{378, Edinburg,U.K, 1994. Springer Verlag, LNCS 788.[20] K. Marriott and H. S ndergaard. Precise and Ef-cient Groundness Analysis for Logic Programs.ACM Letters on Programming Languages and Sys-tems, 2:181{196, 1993.[21] A. Mulkers, W. Simoens, G. Janssens, andM. Bruynooghe. On the Practicality of AbstractEquation Systems. In ICLP95, pages 781{795,1995.[22] K. Muthukumar and M. Hermenegildo. CombinedDetermination of Sharing and Freeness of Pro-gramVariables through Abstract Interpretation. InICLP91, pages 49{63, 1991.[23] K. Muthukumar and M. Hermenegildo. Compile-Time Derivation of Variable Dependency UsingAbstract Interpretation. The Journal of Logic Pro-gramming, 13:315{347, 1992.[24] Magnus Nordin. Igor: A tool for developing ab-stract domains for Prolog Analyzers. PhD thesis,Computing Science Department, Uppsala Univer-sity, 1995.[25] R. Sundararajan and S. Conery. An abstract in-terpretation scheme for groundness, freeness, andsharing analysis of logic programs. In Proceed-ings twelfth FST/TCS conference, pages 203{216.Springer Verlag, LNCS 652, 1992.[26] Andrew Taylor. High Performance Prolog Imple-mentation. PhD thesis, University of Sidney, 1991.[27] P. Van Hentenryck, A. Cortesi, and B. Le Charlier.Evaluation of the domain Prop. The Journal ofLogic Programming, 23(3):237{278, 1995.[28] Peter van Roy. Can Logic Programming Executeas Fast as Imperative Programming. PhD thesis,University of Berkeley, 1991.AppendixProof of Lemma 2:1. From S #S, immediately follows shareJL(S)shareJL(#S). Consider now a sharing pair (X;Y ) 2shareJL(#S). Hence, there is an M 2 #S withX;Y 2 M and an M 0 2 S with M M 0. Thus,(X;Y ) 2 shareJL(S), too.2. From groundJL(S) = V vars(S) and S #Sfollows groundJL(#S) S. Consider now an ar-bitrary X 2 groundJL(S). Then X 62 M for eachM 2 S. Hence, X 62 M 0 for each M 0 M andM 2 S. From this follows X 2 groundJL(#S).3. def JL(#S) = V fVW1 !VW2 j 8M 2 #S:(W2 \M 6= ;)) (W1\M 6= ;)g. Since ((V vars(S))\M 6= ;)) (;\M 6= ;) for allM 2 S, the conjunc-tion V groundJL(S) is a conjunct of def JL(#S).Consider now two other sets W1 und W2 whichful ll the above condition. Suppose that there isa variable X with X 2 W2 and X 2 vars(#S).Hence, fXg 2 #S und W2 \ fXg 6= ;. It must fol-low that W1 \ fXg 6= ;. Thus, X 2 W1, too. Wehave shown that W2 \ vars(S) W1 \ vars(S).Because of the following two propositional rulesx ^ y ^ (y ^ x ! w) = x ^ y ^ (x ! w andx^y^(x! y^w) = x^y^(x! w) we can assume9 that W1 and W2 does not contain variables fromgroundJL(S) = V vars(S). In this caseW2 W1holds. Thus, the conjunctV W1 ! V W2 is equiv-alent to true.210

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

E cient and Precise Sharing Domains for Logic Programs

Sharing information between logical variables is cru cial for a lot of analyses of logic programs e g free ness analysis detection of And parallelism and occur check Therefore the development of accurate sharing domains has attracted a lot of research The sharing domain JL of Jacobs Langen which represents sub stitutions by powersets of variables is considered one of the most precise sharing do...

متن کامل

Computing the Reduced Product of Program Analyses

A reduction relation between abstract domains is introduced to identify situations where computation of the reduced products of program analyses can be made more eecient. A method for eeciently computing the reduced products of program analyses in these situation is presented. The method is illustrated by groundness and pair sharing analyses of logic programs with big eeciency gains on a set of...

متن کامل

An Abstract Interpretation Scheme for Groundedness, Freeness, and Sharing Analysis of Logic Programs

Static global analyses based on abstract interpretation have been used to derive properties of programs. The analyses differ in the expressiveness of the abstract domains and the precision and efficiency of domain operations. We extend an abstract domain defined by Jacobs and Langen and present new abstract domain operations to derive freeness, groundness, and sharing of variables in logic prog...

متن کامل

Analyzing Logic Programs Using \ Prop " -

This paper illustrates the role of a class of \prop"-ositional logic programs in the analysis of complex properties of logic programs. Analyses are performed by abstracting Prolog programs to corresponding \prop"-ositional logic programs which approximate the original programs and have nite meanings. We focus on a groundness analysis which is equivalent to that obtained by abstract interpretati...

متن کامل

Analysing Logic Programs Using 'Prop'-ositional Logic Programs and a Magic Wand

This paper illustrates the role of a class of \prop"-ositional logic programs in the analysis of complex properties of logic programs. Analyses are performed by abstracting Prolog programs to corresponding \prop"-ositional logic programs which approximate the original programs and have nite meanings. We focus on a groundness analysis which is equivalent to that obtained by abstract interpretati...

متن کامل

Precise Set Sharing and Nullity Analysis for Java-style Programs

Finding useful sharing information between instances in object-oriented programs has been recently the focus of much research. The applications of such static analysis are multiple: by knowing which variables share in memory we can apply conventional compiler optimizations, find coarse-grained parallelism opportunities, or, more importantly,erify certain correctness aspects of programs even in ...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1996